// store.js
import { configureStore } from "@reduxjs/toolkit";
import { persistStore, persistReducer } from "redux-persist";
import AsyncStorage from "@react-native-async-storage/async-storage";
import counterReducer from "./counterSlice";
// import counterReducer from './counterSlice';
import authSlice from "./authSlice";

const persistConfig = {
    key: "root",
    storage: AsyncStorage,
};

const persistedReducer = persistReducer(persistConfig, counterReducer);

const store = configureStore({
    reducer: {
        counter: persistReducer(persistConfig, counterReducer),
        userInfo: persistReducer(persistConfig, authSlice),
    },
});
export const persistor = persistStore(store);

export default store;
